﻿using Sirenix.OdinInspector;
using UnityEngine;

namespace HyuFrameWork
{
    /*
     * 1.需要在Inspector窗口显示的用public普通变量
     * 2.不需要显示的用public的static变量
     * 3.需要编译后赋值的用static readonly
     * 4.固定的不需要改变的，且不用显示的用const
     */
    public class GlobalVariables : MonoSingleton<GlobalVariables>
    {
        
#if UNITY_EDITOR
        #region EditorSettings
        
        [BoxGroup("Editor")]public bool ResourceLoad = false;
        [BoxGroup("Editor")]public bool StaticExcelLoad = false;

        #endregion
#endif
        
        #region GlobalVariables(HideInInspector)

        public static bool IsGMActive = false;
        public static bool IsQuitting = false;
        private void OnEnable()
        {
            Application.wantsToQuit += () => IsQuitting = true;
        }

        #endregion
        
        #region Config

        #region ServerConfig

        public const string LocalInnerIP = "127.0.0.1";//内网IP
        //public const string RemoteGateIP = "121.43.226.114";//远端的IP（客户端连的）公有ip
        //public const string RemoteServerIP = "172.27.69.52";//远端服务器IP（服务器绑定的）私有ip
        //云服务器会给服务器一个IP 客户端连的时GateIP 连上后云服务器再转发到服务器的IP
        
        public const int UdpPort = 17666;
        public const int LogicFrameIntervelMs = 66;

        #endregion

        #region ClientConfig

        public const int ScreenStandardWidth = 2160;
        public const int ScreenStandardHeight = 1080;
        
        public const int DirSkillMinDis = 10;//方向性技能 有用时的最小距离
        public const int SkillCancelDis = 500;//技能取消最大距离
    
        //通用移动攻击buffID
        public const int CommonMoveAttackBuffID = 90000;

        public const float ClientLogicFrameDeltaSec = 0.066f;//s

        #endregion

        #region AniTrigger

        public static readonly int CloseAni = Animator.StringToHash("close");
        public static readonly int HideBorderAni = Animator.StringToHash("hideBorder");
        public static readonly int HideAllAni = Animator.StringToHash("hideAll");
        public static readonly int ShowAni = Animator.StringToHash("show");

        #endregion

        #region Color

        [BoxGroup("Color")]public Color HpGreen;
        [BoxGroup("Color")]public Color HpBlue;
        [BoxGroup("Color")]public Color HpRed;
        
        [BoxGroup("Color")]public Color JumpRed;
        [BoxGroup("Color")]public Color JumpGreen;
        [BoxGroup("Color")]public Color JumpGray;
        #endregion

        #region Music

        public const string LobbyBgm = "ArcadeGameBGM#17";
        public const string ProducerBgm = "BGM_04";
        public const string NormalButtonAudio = "DM-CGS-32";
        public const string Normal2ButtonAudio = "DM-CGS-21";
        public const string ConfirmButtonAudio = "DM-CGS-07";
        public const string CloseButtonAudio = "qubodup-hover2";
        public const string TipsAudio = "impactMetal_000";
        
        public const string ReadyGoAudio = "ready_go";
        public const string SkillUIAudio = "DM-CGS-01";
        public const string DeadCountAudio = "DM-CGS-50";
        public const string WinAudio = "jingles_SAX10";
        public const string LoseAudio = "jingles_SAX07";
        
        #endregion

        #endregion
        
        #region SaveData

        [BoxGroup("SaveData")]public GameStatus GameStatus;
        public void SaveGameStatus()
        {
            PersistentService.SaveByJson("GameStatus",GameStatus);
        }
    
        #endregion
    }
}